//
//  AppConfig.h
//  CardCat
//
//  Created by admin on 16/3/1.
//  Copyright (c) 2016年 haoniu. All rights reserved.
//
//  http://61.191.56.59:8090/zentao/user-login.html
//  １５２５６０１３１５２,１２３４５６ｑ
//
//

#import <Foundation/Foundation.h>

#ifdef __OBJC__
#import "MJRefreshGifHeader.h"
#import "Util.h"
#import "AdView.h"
#import "HNPeopleInfo.h"
#import "BlocksKit/BlocksKit.h"
#import "UIColor+BFPaperColors.h"
#import "NSString+RegexCategory.h"
#import "BaseViewController.h"
#import "LoginViewController.h"
#endif




//----------------------其他----------------------------

//NSUserDefaults 实例化
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]

//NotificationCenter 实例化
#define NotificationCenter [NSNotificationCenter defaultCenter]

//方正黑体简体字体定义
#define FONT(F) [UIFont fontWithName:@"FZHTJW--GB1-0" size:F]

//----------------------通知----------------------------
#define Notification_AGGTabViewController @"AGGTabViewControllerNSNotificationCenter"

#define Notification_HNShoppingViewController @"HNShoppingViewControllerNSNotificationCenter"

#define Notification_HNShoppingViewController @"HNShoppingViewControllerNSNotificationCenter"

//----------------------接口----------------------------


#define url_Base  @"http://www.ahnimeng.com:8095/"


//微信支付回调http://www.ahnimeng.com:8095/transaction/notify";


//史挺威的
//#define url_web_Shopping @"http://192.168.3.111:8080/index.html"//商城主页面
//#define url_web_Address @"http://192.168.3.111:8080/address.html"//地址
//#define url_web_ProductDetail @"http://192.168.3.111:8080/detail.html"//商品详情

#define url_web_Shopping @"http://192.168.1.111:8080/index.html"//商城主页面
#define url_web_Address @"http://192.168.1.111:8080/address.html"//地址
#define url_web_ProductDetail @"http://192.168.1.111:8080/detail.html"//商品详情

//#define url_web_Address @"http://wx.umtogo.com/youmai/address.html"
//#define url_web_Shopping @"http://wx.umtogo.com/youmai/index.html"

#pragma mark - 登录注册
#define url_Register  @"app/register"
#define url_Login  @"app/login"
#define url_code  @"app/sms/captcha"//获取验证码
#define url_changePwd_code  @"app/user/update/password/captcha"//密码-短信修改

#define static_sessionId [[NSUserDefaults standardUserDefaults] objectForKey:@"sessionId"]
#define static_username [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInfo"] objectForKey:@"hnLoginName"]

#define msg_InvalidLoginInformation @"登录信息无效,请重新登录"

#pragma mark - 首页
#define url_Advert_list  @"app/advert/list"
#define url_doctor_list @"app/user/info/doctor/list"
#define url_doctor_detail @"app/user/info/doctor/detail"
#define url_doctor_commentList @"app/user/comment/list"
#define url_QuickList @"app/user/info/doctor/detail"//收费医生列表
#define url_comment_add @"app/business/order/comment"//买家评价
#define url_comment_list @"app/user/comment/list"//评价列表


#define url_collect_add @"app/user/collect/add"//添加关注
#define url_collect_delete @"app/user/collect/delete"//取消关注
#define url_collect_list @"app/user/collect/list"//取消关注


#pragma mark - 用户
#define url_userInfo_detail @"app/user/info/detail"//获取用户信息
#define url_userInfoList_tel @"app/user/info/list"//手机号获取用户信息
#define url_update_userInfo @"app/user/info/update"//更新用户信息
#define url_update_userInfo_image @"file/upload"//上传图片
#define url_update_pwd_pwd @"app/user/update/password"//原密码修改密码

#pragma mark - 咨询服务
#define url_get_consultList @"app/goods/list"//获取咨询选择列表
#define url_get_consultDetail @"app/goods/detail"//获取咨询详情
#define url_consultService_start @"app/business/order/service"//获取咨询详情
#define url_consultOrder_sureEnd @"app/business/order/finish"


#pragma mark - 我的订单
#define url_order_myList @"app/business/order/list/mine"
#define url_order_consult @"app/business/order/list"

#define url_order_create @"app/business/order/add"
#define url_order_detail @"app/business/order/detail"
#define url_order_pay @"app/business/order/pay"
#define url_order_delete @"app/business/order/delete"
#define url_order_applyRefund @"app/business/order/refund/apply"//申请退款
#define url_order_sureReceive @"app/business/order/receive"//确认收货

#define url_consultHistory_list @"app/business/order/history/list"
#define url_consultHistory_delete @"app/business/order/history/delete"


#define url_choice_value @"app/vars/list"//选择医院、选择科室、选择职务


#pragma mark - 消息
#define url_message_list  @"app/message/list"





#define mainScreenSize [ UIScreen mainScreen ].bounds.size

#define _pageSize @"10" //分页每页显示条数

// 获取RGB颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)

#define RGBJ(x) RGBA(x,x,x,1.0f)


//在线客服：客服电话
#define on_lineServiceTelPhone 13910233508

#pragma -mark URL链接列表

//baseURL （文档:http://192.168.1.251:8080/HNBuilding/app/api)

#pragma mark - 本地服务器
//#define url_Base @"http://192.168.1.144:8080/HNLuxury/"
//#define url_Base_no @"http://192.168.1.144:8080"
#pragma mark - 发布服务器
//#define url_Base @"http://hnluxury.hfappkf.com/HNLuxury/"
#define url_Base_no @"http://hnluxury.hfappkf.com"

#define HN_username [NSString stringWithFormat:@"%@",[AppConfig getUserInfoByKey:@"hnLoginName"]]

#define url_Download @"shop/download.ajax"//下载

//#define url_Login @"shop/toLogin.ajax"

#define url_Main @"bigCat/html/index.html"
#define url_Main_publish_jimai @"shop/publish/consignment.ajax" //发布闲置和发布速卖
#define url_Main_publish @"shop/publish/quicksell.ajax" //发布闲置和发布速卖

#define url_Home @"shop/index.ajax" //@"bigCat/html/indexHome.html"
#define url_Server @"shop/indexServers.ajax"    //服务中心
#define url_My @"shop/indexMy.ajax" //我
#define url_PersonalInfo @"shop/member/toMyinformation.ajax" //个人资料页面
#define url_User @"shop/indexMy.ajax" //我
#define url_UserInfo @"shop/member/getMember"//用户信息
#define url_UpdateUserImage @"file/commonUploadImgFile.ajax"//上传图片

#pragma mark - 首页
#define url_MyPicture @"shop/index.ajax" //图片
#define url_MyGoods @"shop/indexPro.ajax" //列表
#define url_XianZhi @"shop/help.ajax" //我要鉴定
#define url_JiMai @"shop/help.ajax" //寄卖速卖
#define url_WeiXiuYangHu @"shop/repair/getType.ajax" //维修养护
#define url_XianXiaMenDian @"shop/store/index.ajax" //线下门店
#define url_GuanZhu @"shop/product/index.ajax" //关注+四张图
#define url_ShaiXuan @"shop/filter/index.ajax" //筛选
#define url_ShangPin @"shop/product/details.ajax" //商品

#pragma mark - 图片网页
#define url_Different @"shop/help.ajax" //图片

#pragma mark - 分类
#define url_BrandHotBrand @"shop/productBrand/getHotBrand.ajax" //热门品牌
#define url_BrandAllOfBrand @"shop/productBrand/getAllOfBrand.ajax" //常规品牌
#define url_CategoryProductType @"shop/productType/getProductType.ajax" //分类品牌

#pragma mark - 订单信息
#define url_Address @"shop/index.ajax" //图片
#define url_Coupon @"shop/indexPro.ajax" //列表


#pragma mark - 图片网页
#define url_ShareText @"shop/getFenxiang" //分享页面显示文字
#define url_ShareAPP @"http://2bai.co/11451742" //分享APP
#define str_ShareAPP @"奢站，专业的闲置奢侈品交易平台，买卖双方直接交易，正品保障无风险。" //分享APP

#pragma mark - 订单详情页
#define url_OrderDetails @"shop/order/orderDetails.ajax" //详情
#define url_AddressList @"shop/address/getList.ajax" //地址
#define url_MyTicket @"shop/ticket/getMyTicket.ajax" //优惠券


/**
 * 微信支付渠道
 */
#define CHANNEL_WECHAT @"wx"
/**
 * 支付支付渠道
 */
#define CHANNEL_ALIPAY @"alipay"



//NavBar高度
#define NavigationBar_HEIGHT 44
//设备屏幕尺寸
#define mainScreenSize   ([UIScreen mainScreen].bounds.size)
#define kScreen_Height   ([UIScreen mainScreen].bounds.size.height)
#define kScreen_Width    ([UIScreen mainScreen].bounds.size.width)
#define kScreen_Frame    (CGRectMake(0, 0 ,kScreen_Width,kScreen_Height))
#define kScreen_CenterX  kScreen_Width/2
#define kScreen_CenterY  kScreen_Height/2


@interface AppConfig : NSObject

#pragma -mark 沙盒操作
+(BOOL)saveUserInfo:(NSDictionary *)dic;

+(BOOL)modifyUserInfoByDic:(NSDictionary *)dic;

+(NSDictionary *)getUserInfo;

+(NSString *)getUserInfoByKey:(NSString *)key;

+(BOOL)removeUserInfo;

#pragma mark - 沙箱操作 之 用户信息存储
//判断用户并获取
+(BOOL)addPersonInfo:(NSString *)goodsJsonStr;

+(BOOL)savePeopleInfo:(NSDictionary *)peopleInfo;

+(NSDictionary *)getPeopleInfo:(NSString *)userLoginName;

+(BOOL)removePeopleInfo:(NSString *)userLoginName;


#pragma mark - 系统消息
+(BOOL)saveSystemMessageNum:(NSString *)smNum withUser:(NSString *)loginName;
+(NSString *)getSystemMessageNum:(NSString *)loginName;

+(BOOL)saveVersion:(NSString *)dic;
+(NSString *)getVersion;

//首页数据
+(BOOL)saveHomePageData:(NSDictionary *)dic;
+(NSDictionary *)getHomePageData;

//默认地址
+(BOOL)saveDefaultLocation:(NSDictionary *)dic;
+(NSDictionary *)getDefaultLocation;

//最后一次登录用户名
+(BOOL)saveLastLoginUserName:(NSString *)dic;
+(NSString *)getLastLoginUserName;

//通知设置
+(BOOL)saveNotification:(NSDictionary *)notifi;
+(NSDictionary *)getNotification;

#pragma -mark 获取plist文件
//根据键获取Tool文件中的value
+(NSString *)getStringByToolList:(NSString *)keyStr;

+(NSString *)getStringByUserConfigInfo:(NSString *)keyStr;

+(NSArray *)getArrayByUserConfigInfo:(NSString *)keyStr;

+(NSDictionary *)getDictionaryByUserConfigInfo:(NSString *)keyStr;

+(void)setArrayByUserConfigInfo:(NSString *)keyStr withValue:(NSString *)valStr;




#pragma -mark 图片操作
+(UIImage *)composeImage:(float)bili withImageBack:(UIImage *)imageBack withImage:(UIImage *)image;
+(UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize withImage:(UIImage *)image;
+(UIImage *)clippingImage:(UIImage *)image withWidth:(CGFloat)w withHeight:(CGFloat)h;
+(UIImage *)clippingMaxImage:(UIImage *)image withWidth:(CGFloat)w withHeight:(CGFloat)h;
+(UIImage *)getImageByURL:(NSString *)urlPath;
+(UIImage *)getImageExsit:(NSString *)urlPath;
+(UIImage *)getImageByURLAndExsit:(NSString *)urlPath;
+(UIImage *)getImageByURL:(NSString *)urlPath withW:(CGFloat)w withH:(CGFloat)h;

#pragma -mark 颜色设置
+ (UIColor *)colorWithHexString:(NSString *)color;



#pragma -mark 字符串转化
//将JOSN格式字符串转换为Dictionary
+(NSString*)dictionaryToJson:(NSDictionary *)dic;
//根据Json字符串返回NSArray
+(NSArray *)ArrayWithJsonString:(NSString *)jsonString;
//将Dictionary格式字符串转换为JOSN
+(NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;


//获取动态效果
+(MJRefreshGifHeader *)getCustomMJRefreshGifHeader;

//判断是非为空
+(BOOL)isNULL:(NSString *)inputStr;



+(void)setTags:(NSMutableSet *)tags andAlias:(NSString *)alias;
+(void)cancelTags:(BOOL)cancelTags andcancelAlias:(BOOL)cancelAlias;

@end
